﻿using System.Xml;
using System.Xml.Serialization;

namespace GISUtil.KML
{
  /// <summary>
  /// Contains methods for serializing and deserializing the XML found in the BalloonStyle section of KML
  /// </summary>
  [XmlRoot("BalloonStyle")]
  public class BalloonStyle
  {
    /// <summary>
    /// The unique ID associated with this style.
    /// </summary>
    [XmlAttribute("Id")]//todo: is the capitalization correct?
    public string Id { get; set; }

    /// <summary>
    /// The background Color of the balloon.
    /// </summary>
    [XmlElement("bgColor")]
    public string BackgroundColor { get; set; }

    /// <summary>
    /// The Color of the Text within the balloon.
    /// </summary>
    [XmlElement("textColor")]
    public string TextColor { get; set; }

    /// <summary>
    /// The Text contained inside the balloon.
    /// </summary>
    [XmlElement("text")]
    public string Text { get; set; }

    /// <summary>
    /// The display mode associated with this style.
    /// </summary>
    [XmlElement("displayMode")]
    public DisplayMode? DisplayMode { get; set; }

    /// <summary>
    /// Determines if this class has any styling information associated with it. 
    /// </summary>
    /// <returns>True if at least one of the fields that contains style information has a value, otherwise false.</returns>
    public bool HasAValue()
    {
      return Id != null ||
        BackgroundColor != null ||
        TextColor != null ||
        Text != null ||
        DisplayMode != null;
    }
  }
}